package org.chenmin.gwt.client.components;

import com.axellience.vuegwt.core.annotations.component.Component;
import com.axellience.vuegwt.core.annotations.component.Computed;
import com.axellience.vuegwt.core.annotations.component.Prop;
import com.axellience.vuegwt.core.client.component.IsVueComponent;
import jsinterop.annotations.JsMethod;

@Component
public class TooComponent implements IsVueComponent {

    @Prop
    Todo todo;

    /**
     * Emit an event when we want to delete the todo
     */
    @JsMethod
    public void removeTodo() {
        vue().$emit("removeTodo", todo);
    }

    @Computed
    public boolean getIsDoneTodo() {
        return this.todo.isDone();
    }

    @Computed
    public void setIsDoneTodo(boolean isDone) {
        this.todo.setDone(isDone);
    }
}